package com.systemmanger.mapper;

import com.bean.WmsTPermission;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @AUTHOR(闫晨航)
 * @date2021-12-08 14:04
 */
public interface PermMapper {
    @Select("select * from wms_t_permission where permIsDel='0'")
    public List<WmsTPermission> getAllPerms();
    @Select("<script>select * from wms_t_permission\n" +
            "        where 1=1\n" +
            "        <if test=\"permName!=null\">\n" +
            "            and permName = #{permName}\n" +
            "        </if>\n" +
            "        <if test=\"permID!=null\">\n" +
            "            and permID = #{permID}\n" +
            "        </if> and permIsDel='0'\n" +
            "</script>")
    public List<WmsTPermission> getPerms(Map<String, Object> map);
    @Select("select groupId from wms_t_perm_group where permid = #{value}")
    public String getGroupid(String permId);
    @Update("update wms_t_user set userIsDel = '1' where userId in(select ugUserId from wms_t_u_g where ugGroupid = #{value})")
    public void updateUser(String groupId);
    @Update("update wms_t_group set groupIsDel = '1' where groupID in (select groupID from wms_t_perm_group where permID = #{value})")
    public void updateGroup(String PermId);
    @Update("update wms_t_permission set permIsDel = '1' where permID = #{value}")
    public void updatePerm(String permId);
}
